<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>叩丁狼骡窝窝后台管理系统</title>
<#include "../common/header.ftl" >
    <script>
        $(function () {
            $('.lookBtn').click(function () {
                console.log(1);
                //查看文章的点击事件
                var id = $(this).data('id');
                $.get('/travel/getContentById', {id: id}, function (data) {
                    $('#content').html(data.content);
                });
                $('#inputModal').modal('show');
            });
            //拒绝  更改state
            $('.updateStateBtn').click(function () {
                var id = $(this).data('id');
                var state = $(this).data('state');
                $.get('/travel/updateState', {state: state, id: id}, function (data) {
                    handleMessage(data);
                });
            });
        })
    </script>

</head>
<body>

<div class="container-fluid" style="margin-top: 20px">
<#include "../common/top.ftl">
    <div class="row">
        <div class="col-sm-2">
        <#assign currentMenu="releaseList"/>
            <#include "../common/menu.ftl">
        </div>
        <div class="col-sm-10">
            <div class="row">
                <div class="col-sm-12">
                    <h1 class="page-head-line">已发布游记页面</h1>
                </div>
            </div>

            <!--高级查询--->
            <form class="form-inline" id="searchForm" action="/travel/releaseList" method="post">
                <input type="hidden" name="currentPage" id="currentPage" value="1">
            </form>

            <table class="table table-striped table-hover">
                <thead>
                <tr>
                    <th>编号</th>
                    <th>标题</th>
                    <th>封面</th>
                    <th>地点</th>
                    <th>作者</th>
                    <th>发布时间</th>
                    <th>状态</th>
                    <th>操作</th>
                </tr>
                </thead>
            <#list pageInfo.list as entity>
                <tr>
                    <td>${entity_index + 1}</td>
                    <td>${entity.title}</td>
                    <td><img src="${entity.coverUrl}" width="100px"></td>
                    <td>${entity.dest.name!}</td>
                    <td>${(entity.author.nickName)!}</td>
                    <td>${(entity.releaseTime)?string("yyyy-MM-dd")}</td>
                    <td>${entity.stateName}</td>
                    <td>
                        <a class="btn btn-danger btn-xs updateStateBtn" data-id="${entity.id}" data-state="-1">
                            <span class="glyphicon glyphicon-minus-sign"></span> 取消发布
                        </a>
                        <a class="btn btn-info btn-xs lookBtn" data-id="${entity.id}">
                            <span class="glyphicon glyphicon-th"></span> 查看文章
                        </a>
                    </td>
                </tr>
            </#list>
            </table>
        <#include "../common/page.ftl"/>
        </div>
    </div>
</div>


<!-- 模态框必须作为body的子标签 -->
<div class="modal fade" id="inputModal" tabindex="-1" role="dialog"
     aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title" id="myModalLabel">查看文章内容</h4>
            </div>
            <div class="modal-body" id="content">

            </div>
        </div>
    </div>
</div>


<!-- 大图显示 -->
<div id="ShowImage_Form" class="modal fade">
    <div class="modal-dialog">
        <div class="modal-content">

            <div class="modal-body">
            </div>
        </div>
    </div>
</div>


<script>
    $("table img").click(function () {
        var src = $(this).attr("src");
        $("#ShowImage_Form .modal-body").html("<img src='" + src + "' class='carousel-inner img-responsive img-rounded' />");
        $("#ShowImage_Form").modal('show');
    })
</script>


</body>
</html>